/*
 * 项目名称:    wms-server-jeecg
 * 创建人员:    gongwenkai
 * 创建时间:    2023-09-27
 */
package org.jeecg.modules.flow.callback.outbound.order;

import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.flow.sys.common.BaseCustomBeanRun;
import org.jeecg.modules.flow.sys.entity.dto.BaseFlowDto;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * 叠片叫料出库单提交回调bean
 *
 * @author gongwenkai
 * @version 1.0.0
 * @since 2023-09-27
 */
@RequiredArgsConstructor
@Component
public class OutBoundReceiptDPJLSubmitBean<T> extends BaseCustomBeanRun<T> {

    /**
     * 业务逻辑 叠片叫料出库单提交
     */
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void actureRun() {

        BaseFlowDto baseFlowDto = this.getBaseFlowDto();
        baseFlowDto.translateClass(JSONObject.class);
        JSONObject jsonData= (JSONObject)baseFlowDto.getData();
        String receiptId = jsonData.getString("id");
        // do nothing
        // 当前前端调用业务需要你返回的
        baseFlowDto.setResult(Result.OK());
        // id是保存业务记录的id。用于生成业务流程信息记录
        baseFlowDto.setInfoId(receiptId);
    }

}
